/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author owtee
 */
@Entity
@Table(name = "job_items")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "JobItems.findAll", query = "SELECT j FROM JobItems j"),
    @NamedQuery(name = "JobItems.findByItemId", query = "SELECT j FROM JobItems j WHERE j.itemId = :itemId"),
    @NamedQuery(name = "JobItems.findByItemName", query = "SELECT j FROM JobItems j WHERE j.itemName = :itemName"),
    @NamedQuery(name = "JobItems.findByActiveFlag", query = "SELECT j FROM JobItems j WHERE j.activeFlag = :activeFlag"),
    @NamedQuery(name = "JobItems.findByCreateUser", query = "SELECT j FROM JobItems j WHERE j.createUser = :createUser"),
    @NamedQuery(name = "JobItems.findByCreateDate", query = "SELECT j FROM JobItems j WHERE j.createDate = :createDate"),
    @NamedQuery(name = "JobItems.findByModifyUser", query = "SELECT j FROM JobItems j WHERE j.modifyUser = :modifyUser"),
    @NamedQuery(name = "JobItems.findByModifyDate", query = "SELECT j FROM JobItems j WHERE j.modifyDate = :modifyDate")})
public class JobItems implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Item_Id")
    private Integer itemId;
    @Size(max = 10)
    @Column(name = "Item_Name")
    private String itemName;
    @Column(name = "Active_Flag")
    private Boolean activeFlag;
    @Size(max = 10)
    @Column(name = "Create_User")
    private String createUser;
    @Column(name = "Create_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Size(max = 10)
    @Column(name = "Modify_User")
    private String modifyUser;
    @Column(name = "Modify_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifyDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "itemId")
    private Collection<JobDetails> jobDetailsCollection;

    public JobItems() {
    }

    public JobItems(Integer itemId) {
        this.itemId = itemId;
    }

    public Integer getItemId() {
        return itemId;
    }

    public void setItemId(Integer itemId) {
        this.itemId = itemId;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public Boolean getActiveFlag() {
        return activeFlag;
    }

    public void setActiveFlag(Boolean activeFlag) {
        this.activeFlag = activeFlag;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getModifyUser() {
        return modifyUser;
    }

    public void setModifyUser(String modifyUser) {
        this.modifyUser = modifyUser;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }

    @XmlTransient
    public Collection<JobDetails> getJobDetailsCollection() {
        return jobDetailsCollection;
    }

    public void setJobDetailsCollection(Collection<JobDetails> jobDetailsCollection) {
        this.jobDetailsCollection = jobDetailsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemId != null ? itemId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JobItems)) {
            return false;
        }
        JobItems other = (JobItems) object;
        if ((this.itemId == null && other.itemId != null) || (this.itemId != null && !this.itemId.equals(other.itemId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.JobItems[ itemId=" + itemId + " ]";
    }
    
}
